package com.sugar.subscribe.course.module.business.dal.mysql.serviceclass;

import java.util.*;

import com.sugar.subscribe.course.framework.common.pojo.PageResult;
import com.sugar.subscribe.course.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.sugar.subscribe.course.framework.mybatis.core.mapper.BaseMapperX;
import com.sugar.subscribe.course.module.business.dal.dataobject.serviceclass.ServiceClassDO;
import org.apache.ibatis.annotations.Mapper;
import com.sugar.subscribe.course.module.business.controller.admin.serviceclass.vo.*;

/**
 * 服务分类 Mapper
 *
 * @author Ysugar
 */
@Mapper
public interface ServiceClassMapper extends BaseMapperX<ServiceClassDO> {

    default PageResult<ServiceClassDO> selectPage(ServiceClassPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ServiceClassDO>()
                .likeIfPresent(ServiceClassDO::getName, reqVO.getName())
                .eqIfPresent(ServiceClassDO::getParentId, reqVO.getParentId())
                .eqIfPresent(ServiceClassDO::getHomeRecommend, reqVO.getHomeRecommend())
                .betweenIfPresent(ServiceClassDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ServiceClassDO::getSort));
    }

}